'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  const UserSchema = new Schema({
    __v: { type: Number, select: false },
    // 用户名
    username: { type: String, index: 1 },
    // 密码
    password: { type: String ,select:false},
    // 权限
    role: { type: String, default: 'user' },
    // 头像
    avatar: { type: String, default: '' },
    // IP
    ip: { type: String, default: '' },
    // 状态 0 待审 1 正常 -1 封禁
    status: { type: Number, enum: [ 0, 1, -1 ], default: 1 },
  }, { timestamps: true });
  return mongoose.model('User', UserSchema);
};
